// Include files.
#include "StateDoneCode.hpp"

StateDoneCode StateDoneCode::GetNotDoneCode()
{
	return StateDoneCode(-0x01);
}

StateDoneCode StateDoneCode::GetSuccessCode()
{
	return StateDoneCode(0x00);
}

StateDoneCode StateDoneCode::GetNotYetCode()
{
	return StateDoneCode(0x01);
}

StateDoneCode StateDoneCode::GetGenericErrorCode()
{
	return StateDoneCode(-0x02);
}

StateDoneCode StateDoneCode::GetCancelErrorCode()
{
	return StateDoneCode(-0x03);
}

StateDoneCode::StateDoneCode(int code) :
	m_code(code)
{
}

StateDoneCode::StateDoneCode(const StateDoneCode &code) :
	m_code(code.GetCode())
{
}

int StateDoneCode::GetCode() const
{
	return m_code;
}

bool StateDoneCode::IsDone() const
{
	return *this != GetNotDoneCode();
}

bool StateDoneCode::IsError() const
{
	return m_code < -1;
}

bool StateDoneCode::operator ==(StateDoneCode other) const
{
	return m_code == other.m_code;
}

bool StateDoneCode::operator !=(StateDoneCode other) const
{
	return m_code != other.m_code;
}

bool StateDoneCode::operator <(StateDoneCode other) const
{
	return m_code < other.m_code;
}

bool StateDoneCode::operator >(StateDoneCode other) const
{
	return m_code > other.m_code;
}

bool StateDoneCode::operator <=(StateDoneCode other) const
{
	return m_code <= other.m_code;
}

bool StateDoneCode::operator >=(StateDoneCode other) const
{
	return m_code >= other.m_code;
}
